package com.ruoyi.web.controller.position;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.position.domain.JzssHistory;
import com.ruoyi.control.service.IJzssHistoryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 人员定位-基站历史数据Controller
 * 
 * @author ruoyi
 * @date 2024-11-12
 */
@RestController
@RequestMapping("/control/substationHistory")
public class JzssHistoryController extends BaseController
{
    @Autowired
    private IJzssHistoryService jzssHistoryService;

    /**
     * 查询人员定位-基站历史数据列表
     */
    @PreAuthorize("@ss.hasPermi('control:substationHistory:list')")
    @GetMapping("/list")
    public TableDataInfo list(JzssHistory jzssHistory)
    {
        startPage();
        List<JzssHistory> list = jzssHistoryService.selectJzssHistoryList(jzssHistory);
        return getDataTable(list);
    }

    /**
     * 导出人员定位-基站历史数据列表
     */
    @PreAuthorize("@ss.hasPermi('control:substationHistory:export')")
    @Log(title = "人员定位-基站历史数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JzssHistory jzssHistory)
    {
        List<JzssHistory> list = jzssHistoryService.selectJzssHistoryList(jzssHistory);
        ExcelUtil<JzssHistory> util = new ExcelUtil<JzssHistory>(JzssHistory.class);
        util.exportExcel(response, list, "人员定位-基站历史数据数据");
    }

    /**
     * 获取人员定位-基站历史数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('control:substationHistory:query')")
    @GetMapping(value = "/{personSubstatonId}")
    public AjaxResult getInfo(@PathVariable("personSubstatonId") String personSubstatonId)
    {
        return success(jzssHistoryService.selectJzssHistoryByPersonSubstatonId(personSubstatonId));
    }

    /**
     * 新增人员定位-基站历史数据
     */
    @PreAuthorize("@ss.hasPermi('control:substationHistory:add')")
    @Log(title = "人员定位-基站历史数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JzssHistory jzssHistory)
    {
        return toAjax(jzssHistoryService.insertJzssHistory(jzssHistory));
    }

    /**
     * 修改人员定位-基站历史数据
     */
    @PreAuthorize("@ss.hasPermi('control:substationHistory:edit')")
    @Log(title = "人员定位-基站历史数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JzssHistory jzssHistory)
    {
        return toAjax(jzssHistoryService.updateJzssHistory(jzssHistory));
    }

    /**
     * 删除人员定位-基站历史数据
     */
    @PreAuthorize("@ss.hasPermi('control:substationHistory:remove')")
    @Log(title = "人员定位-基站历史数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{personSubstatonIds}")
    public AjaxResult remove(@PathVariable String[] personSubstatonIds)
    {
        return toAjax(jzssHistoryService.deleteJzssHistoryByPersonSubstatonIds(personSubstatonIds));
    }
}
